import request from '@/fetch/fetch'

export function mobileLogin(obj) {
  return request({
    url: '/api/web/index/login',
    method: 'post',
    data:obj
  })
}

export function resetPwd(obj) {
  return request({
    url: '/api/web/index/reset-pwd',
    method: 'post',
    data:obj
  })
}

export function getUserinfo(obj) {
  return request({
    url: '/api/web/client/user-info',
    method: 'post',
    data:obj
  })
}

export function getUsers(obj) {
  return request({
    url: '/api/web/landlord/user-info',
    method: 'post',
    data:obj
  })
}

export function setCookie(key,val,time){
  var date=new Date(); 
  var expiresDays=time;
  date.setTime(date.getTime()+expiresDays*24*3600*1000); 
  document.cookie = key + "=" + val +";expires=" + date.toGMTString() + ";path=/" ;
}

export function removeCookie(key){
    setCookie(key,"asdad",-1)
}

export function getCookie(key){
  var arr = document.cookie.split("; ");
  for(var i=0;i<arr.length;i++){
    if(arr[i].split("=")[0] == key){
      return arr[i].split("=")[1]
    }
  }
  return "";
}